extends Node

class_name ActionController

var parent :Human

func _enter_tree():
	parent = get_parent()
	parent.controller
	
func checkKey():
	if Input.is_action_just_pressed("k_action"):
		print("start progress")
		parent.startProgress() # 开始处理事情的时候,其他可以忽略
		parent.direction = Vector2.ZERO
		return 
	
	var inputVec = Input.get_vector("k_left", "k_right", "k_up", "k_down")
	parent.direction = inputVec
	
	if Input.is_action_pressed("k_run"):
		parent.setRun()
	else:
		parent.setWalk()
	
# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.
	
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	checkKey()
